<?php

namespace App\Models;
use Illuminate\Database\Eloquent\Model;


class User extends Model
{
    protected $table = 'user';
    public $timestamps = false;
    //生成登陆验证的token
    public static function makeToken(string $uniqid) {
        $str = uuid() . "#" . md5($uniqid) . "#" . rand_char(10);
        return base64_encode($str);
    }

    //修改用户信息
    static function updateUser($id,$user_nickname,$pic,$sex){
        return self::where('id',$id)->update(['nickname'=>$user_nickname,'avatar'=>$pic,'sex'=>$sex,'updated_at'=>time()]);
    }

}
